<template>
<div>
  <nuxt-link to="/">go back </nuxt-link>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
  <h2>Just for the sake to get scrolled</h2>
</div>
</template>

<script>
export default {
  mounted() {
    this.$nextTick(this.scroll())
  },
  methods: {
    scroll() {
      window.onscroll = ev => {
        if (window.innerHeight + window.scrollY >= document.body.offsetHeight) {
          console.log(window.innerHeight + window.scrollY)
          console.log(document.body.offsetHeight)
          console.log(`Im called, hey im on ${this.$route.name}`)
        }
      }
    }
  }
}
</script>

